<!doctype html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录成功页面</title>
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css"></script>
</head>

<body onload="Check()">
<div class="jumbotron" style="height: 220px;">
    <div class="container" style="text-align: center;">
        <h1><strong>兰陈昕的第三期作业</strong></h1>
        <h2><strong>欢迎你来到这</strong></h2>
    </div>
    <br>
    <div class="container" style="width: 1000px; margin: auto">
        <span id="span1"></span>
        <div style="float: right;">
            <a type="button" class="btn btn-default btn-sm"
               href="https://yxl76.gitee.io/three_phase/login_page.html">注销</a>
        </div>
    </div>
</div>

<div style="width: 800px; margin: auto;">
    <table class="table table-hover">
        <thead>
        <tr>
            <th>用户名</th>
            <th>电子邮箱</th>
            <th>注册时间</th>
            <th>上次登录时间</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td id="id1"></td>
            <td id="id2"></td>
            <td id="id3"></td>
            <td id="id4"></td>
        </tr>
        </tbody>
    </table>
</div>
<script>
    const url = window.location.href;
    const l = url.indexOf("=");
    const r = url.indexOf("+");
    if (l === -1)
        location.href = "https://yxl76.gitee.io/three_phase/login_page.html";
    const kna = url.substr(l + 1, r - l - 1);
    const pwd = url.substr(r + 1);
    const str = localStorage.getItem(kna);
    const site = JSON.parse(str);
    if (pwd !== site.pwd)
        location.href = "https://yxl76.gitee.io/three_phase/login_page.html";
    document.getElementById("span1").innerHTML = '<strong>' + site.usn + '<strong>';
    document.getElementById("id1").innerHTML = site.usn;
    document.getElementById("id2").innerHTML = site.eml;
    document.getElementById("id3").innerHTML = site.fDate;
    document.getElementById("id4").innerHTML = site.sDate;
    const date = new Date();
    const obj = {usn: site.usn, eml: site.eml, pwd: site.pwd, fDate: site.fDate, sDate: date.toLocaleString()};
    const stri = JSON.stringify(obj);
    localStorage.removeItem(kna);
    localStorage.setItem(obj.eml, stri);
</script>
</body>

</html>
